// Warm color palette - 与其他页面保持一致
$primary-color: #f59e0b;
$primary-dark: #d97706;
$primary-light: #fbbf24;
$secondary-color: #fcd34d;
$success-color: #10b981;
$warning-color: #f59e0b;
$danger-color: #ef4444;
$dark-color: #374151;
$gray-color: #6b7280;
$light-gray: #fef7f0;
$white: #ffffff;

// Shadows
$shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
$shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
$shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
$shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

.statistics-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 50%, #fbbf24 100%);
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.animated-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.floating-icons {
  position: absolute;
  width: 100%;
  height: 100%;
}

.float-icon {
  position: absolute;
  font-size: 48rpx;
  opacity: 0.6;
  animation: float 6s ease-in-out infinite;
  
  &:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
  &:nth-child(2) { top: 20%; right: 15%; animation-delay: 1s; }
  &:nth-child(3) { top: 60%; left: 20%; animation-delay: 2s; }
  &:nth-child(4) { top: 30%; left: 80%; animation-delay: 0.5s; }
  &:nth-child(5) { top: 70%; right: 25%; animation-delay: 1.5s; }
  &:nth-child(6) { top: 80%; left: 50%; animation-delay: 2.5s; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

.statistics-page .top-navbar,
.statistics-page .statistics-content {
  position: relative;
  z-index: 1;
}

/* 顶部导航栏 */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: $shadow-sm;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;

  .back-icon {
    color: $gray-color;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 8px;

    &:hover {
      color: $primary-color;
      background: rgba($primary-color, 0.1);
      transform: scale(1.1);
    }
  }

  .page-title {
    font-size: 40px;
    font-weight: 700;
    color: $dark-color;
    letter-spacing: 0.5px;
  }
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  
  .nav-icon {
    color: $gray-color;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 8px;
    
    &:hover {
      color: $primary-color;
      background: rgba($primary-color, 0.1);
    }
  }
}

/* 统计内容区域 */
.statistics-content {
  padding: 0 24px 120px 24px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  
  &::-webkit-scrollbar {
    width: 8px;
  }
  
  &::-webkit-scrollbar-track {
    background: transparent;
  }
  
  &::-webkit-scrollbar-thumb {
    background: rgba($gray-color, 0.3);
    border-radius: 4px;
    
    &:hover {
      background: rgba($gray-color, 0.5);
    }
  }
}

/* 总览区域 */
.overview-section {
  margin: 24px 0 32px 0;
}

.overview-header {
  text-align: center;
  padding: 32px;
  background: rgba(255, 255, 255, 0.85);
  margin-bottom: 24px;
  border-radius: 20px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;

  &::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba($primary-color, 0.1) 0%, rgba($secondary-color, 0.1) 100%);
    border-radius: 50%;
    pointer-events: none;
  }

  .section-title {
    font-size: 56px;
    font-weight: 800;
    color: $dark-color;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
  }

  .section-subtitle {
    font-size: 34px;
    color: $gray-color;
    line-height: 1.6;
    position: relative;
    z-index: 1;
  }
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.overview-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  text-align: center;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: all 0.3s ease;
  }

  &.total::before {
    background: linear-gradient(90deg, $primary-color, $primary-light);
  }

  &.normal::before {
    background: linear-gradient(90deg, $success-color, #34d399);
  }

  &.warning::before {
    background: linear-gradient(90deg, $warning-color, #fbbf24);
  }

  &.danger::before {
    background: linear-gradient(90deg, $danger-color, #f87171);
  }

  &:hover {
    transform: translateY(-8px);
    box-shadow: $shadow-xl;

    &.total {
      border-color: rgba($primary-color, 0.2);
    }

    &.normal {
      border-color: rgba($success-color, 0.2);
    }

    &.warning {
      border-color: rgba($warning-color, 0.2);
    }

    &.danger {
      border-color: rgba($danger-color, 0.2);
    }
  }

  .card-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
  }

  .card-content {
    .card-number {
      font-size: 48px;
      font-weight: 800;
      color: $dark-color;
      margin-bottom: 8px;
      display: block;

      .total & {
        color: $primary-color;
      }

      .normal & {
        color: $success-color;
      }

      .warning & {
        color: $warning-color;
      }

      .danger & {
        color: $danger-color;
      }
    }

    .card-label {
      font-size: 24px;
      color: $gray-color;
      font-weight: 600;
      display: block;
    }
  }
}

/* 图表区域 */
.chart-section {
  margin-bottom: 32px;
}

.chart-header {
  text-align: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px;
  border-radius: 20px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);

  .section-title {
    font-size: 36px;
    font-weight: 700;
    color: $dark-color;
    margin-bottom: 8px;
  }

  .section-subtitle {
    font-size: 24px;
    color: $gray-color;
    font-weight: 500;
  }
}

.status-chart {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  padding: 32px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

/* 环形图表样式 */
.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.donut-chart {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: $shadow-lg;
  
  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
  }
}

.donut-center {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-total {
  font-size: 48px;
  font-weight: 800;
  color: $dark-color;
  line-height: 1;
  margin-bottom: 4px;
}

.donut-label {
  font-size: 20px;
  color: $gray-color;
  font-weight: 600;
}

/* 图例样式 */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 300px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba($gray-color, 0.05);
  border-radius: 12px;
  transition: all 0.2s ease;
  
  &:hover {
    background: rgba($primary-color, 0.1);
    transform: translateX(4px);
  }
  
  &.normal .legend-color {
    background: linear-gradient(135deg, $success-color, #34d399);
  }
  
  &.warning .legend-color {
    background: linear-gradient(135deg, $warning-color, #fbbf24);
  }
  
  &.danger .legend-color {
    background: linear-gradient(135deg, $danger-color, #f87171);
  }
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-text {
  flex: 1;
  font-size: 24px;
  color: $dark-color;
  font-weight: 500;
}

.legend-percentage {
  font-size: 20px;
  color: $gray-color;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* 柱状图表样式 */
.bar-chart-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 32px;
  height: 200px;
  width: 100%;
  max-width: 400px;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
}

.chart-bar {
  width: 60px;
  border-radius: 8px 8px 0 0;
  transition: all 0.3s ease;
  margin-bottom: 12px;
  position: relative;
  min-height: 20px;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.3));
    animation: shimmer 2s infinite;
  }

  &.normal {
    background: linear-gradient(180deg, $success-color, #34d399);
  }

  &.warning {
    background: linear-gradient(180deg, $warning-color, #fbbf24);
  }

  &.danger {
    background: linear-gradient(180deg, $danger-color, #f87171);
  }
}

@keyframes shimmer {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

.bar-label {
  font-size: 24px;
  color: $gray-color;
  font-weight: 600;
  margin-bottom: 4px;
}

.bar-value {
  font-size: 32px;
  font-weight: 800;
  color: $dark-color;
}

/* 统计列表区域 */
.category-section,
.location-section {
  margin-bottom: 32px;
}

.section-header {
  text-align: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px;
  border-radius: 20px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);

  .section-title {
    font-size: 36px;
    font-weight: 700;
    color: $dark-color;
    margin-bottom: 8px;
  }

  .section-subtitle {
    font-size: 24px;
    color: $gray-color;
    font-weight: 500;
  }
}

.stats-list {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  padding: 24px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: rgba($gray-color, 0.05);
  border-radius: 16px;
  transition: all 0.3s ease;
  border: 2px solid transparent;

  &:hover {
    background: rgba($primary-color, 0.1);
    border-color: rgba($primary-color, 0.2);
    transform: translateY(-2px);
    box-shadow: $shadow-md;
  }
}

.stat-info {
  display: flex;
  align-items: center;
  gap: 16px;

  .stat-emoji {
    font-size: 40px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba($primary-color, 0.1);
    border-radius: 14px;
    flex-shrink: 0;
  }

  .stat-text {
    .stat-name {
      font-size: 28px;
      font-weight: 700;
      color: $dark-color;
      margin-bottom: 4px;
      display: block;
    }

    .stat-count {
      font-size: 22px;
      color: $gray-color;
      font-weight: 500;
      display: block;
    }
  }
}

.stat-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 120px;

  .progress-bar {
    width: 80px;
    height: 8px;
    background: rgba($gray-color, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;

    .progress-fill {
      height: 100%;
      border-radius: 4px;
      transition: width 0.3s ease;
      position: relative;

      &::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
        animation: shimmer 2s infinite;
      }
    }
  }

  .stat-percentage {
    font-size: 20px;
    font-weight: 700;
    color: $dark-color;
    min-width: 40px;
    text-align: right;
  }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  background: rgba(255, 255, 255, 0.85);
  margin: 24px 0;
  border-radius: 20px;
  box-shadow: $shadow-md;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;

  &::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba($primary-color, 0.1) 0%, rgba($secondary-color, 0.1) 100%);
    border-radius: 50%;
    pointer-events: none;
  }

  .empty-icon {
    font-size: 96px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
  }

  .empty-title {
    font-size: 48px;
    font-weight: 800;
    color: $dark-color;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
  }

  .empty-subtitle {
    font-size: 28px;
    color: $gray-color;
    margin-bottom: 32px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
  }

  .go-add-btn {
    background: linear-gradient(135deg, $primary-color, $primary-dark);
    border: none;
    color: white;
    border-radius: 50rpx;
    padding: 20px 40px;
    font-size: 24px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    min-height: 64px;
    width: 100%;
    
    .at-button__text {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      text-align: center;
      line-height: 1.2;
      color: white;
      font-size: 24px;
      font-weight: 600;
    }

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 25px rgba(245, 158, 11, 0.4);
    }
  }
}

/* 底部操作栏 */
.bottom-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  gap: 16px;
  z-index: 100;
}

.bottom-action-btn {
  flex: 1;
  border-radius: 12px;
  padding: 18px 24px;
  font-weight: 600;
  font-size: 20px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  min-height: 56px;

  &.secondary {
    background: rgba($gray-color, 0.1);
    color: $gray-color;
    border: none;

    &:hover {
      background: rgba($gray-color, 0.2);
    }

    .at-button__text {
      color: $gray-color;
      font-size: 20px;
      font-weight: 600;
    }
  }

  &:not(.secondary) {
    background: linear-gradient(135deg, $primary-color, $primary-dark);
    border: none;
    color: white;
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.25);

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px 0 rgba(245, 158, 11, 0.35);
    }

    .at-button__text {
      color: white;
      font-size: 20px;
      font-weight: 600;
    }
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .overview-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .chart-bars {
    gap: 20px;
  }

  .chart-bar {
    width: 40px;
  }

  .statistics-content {
    padding: 0 16px 120px 16px;
  }

  .overview-header,
  .chart-header,
  .section-header {
    padding: 20px;
  }

  .stats-list {
    padding: 20px;
  }

  .stat-item {
    padding: 16px;
  }

  .empty-state {
    padding: 48px 24px;
  }

  .bottom-actions {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .top-navbar {
    padding: 12px 16px;

    .navbar-left .page-title {
      font-size: 28px;
    }
  }

  .overview-header {
    .section-title {
      font-size: 36px;
    }

    .section-subtitle {
      font-size: 24px;
    }
  }

  .overview-card {
    padding: 24px 20px;

    .card-icon {
      font-size: 40px;
    }

    .card-content {
      .card-number {
        font-size: 36px;
      }

      .card-label {
        font-size: 20px;
      }
    }
  }

  .chart-header,
  .section-header {
    .section-title {
      font-size: 28px;
    }

    .section-subtitle {
      font-size: 20px;
    }
  }

  .chart-bars {
    height: 150px;
    gap: 16px;
  }

  .chart-bar {
    width: 32px;
  }

  .bar-label {
    font-size: 20px;
  }

  .bar-value {
    font-size: 24px;
  }

  .stat-info {
    gap: 12px;

    .stat-emoji {
      font-size: 32px;
      width: 48px;
      height: 48px;
    }

    .stat-text {
      .stat-name {
        font-size: 24px;
      }

      .stat-count {
        font-size: 18px;
      }
    }
  }

  .stat-progress {
    min-width: 100px;

    .progress-bar {
      width: 60px;
    }

    .stat-percentage {
      font-size: 18px;
    }
  }

  .empty-state {
    .empty-title {
      font-size: 32px;
    }

    .empty-subtitle {
      font-size: 22px;
    }
  }
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.overview-card,
.stat-item {
  animation: fadeIn 0.5s ease-out;
}

.overview-card:nth-child(1) { animation-delay: 0.05s; }
.overview-card:nth-child(2) { animation-delay: 0.1s; }
.overview-card:nth-child(3) { animation-delay: 0.15s; }
.overview-card:nth-child(4) { animation-delay: 0.2s; }

.stat-item:nth-child(1) { animation-delay: 0.05s; }
.stat-item:nth-child(2) { animation-delay: 0.1s; }
.stat-item:nth-child(3) { animation-delay: 0.15s; }
.stat-item:nth-child(4) { animation-delay: 0.2s; }
.stat-item:nth-child(5) { animation-delay: 0.25s; }
.stat-item:nth-child(6) { animation-delay: 0.3s; }
